package com.dmgis.hndz.controller;

import com.dmgis.hndz.common.result.HttpStatusEnum;
import com.dmgis.hndz.common.result.ResponseResult;
import com.dmgis.hndz.common.utils.SysResult;
import com.dmgis.hndz.pojo.SMSTemplateManagement;
import com.dmgis.hndz.service.SMSTemplateManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author pengdongdong
 * @description public
 * @date 2024-11-11
 */
@CrossOrigin
@RestController
@RequestMapping(value = "/sMSTemplateManagement")
public class SMSTemplateManagementController {

    @Autowired
    private SMSTemplateManagementService sMSTemplateManagementService;

    /**
     * 新增
     *
     * @author pengdongdong
     * @date 2024/11/11
     **/
    @PostMapping("/save")
    public SysResult insertSMSTemplateManagement(@RequestBody SMSTemplateManagement sMSTemplateManagement) {
        return SysResult.success(sMSTemplateManagementService.insertSMSTemplateManagement(sMSTemplateManagement));
    }

    /**
     * 刪除
     *
     * @author pengdongdong
     * @date 2024/11/11
     **/
    @PostMapping("/delete")
    public SysResult deleteSMSTemplateManagement(String ids) {
        return SysResult.success(sMSTemplateManagementService.deleteSMSTemplateManagement(ids));
    }

    /**
     * 更新
     *
     * @author pengdongdong
     * @date 2024/11/11
     **/
    @PostMapping("/update")
    public SysResult updateSMSTemplateManagement(@RequestBody SMSTemplateManagement sMSTemplateManagement) {
        return SysResult.success(sMSTemplateManagementService.updateSMSTemplateManagement(sMSTemplateManagement));
    }

    /**
     * 查询 根据主键 id 查询
     *
     * @author pengdongdong
     * @date 2024/11/11
     **/
    @GetMapping("/getById")
    public ResponseResult selectSMSTemplateManagementById(String id) {
        return new ResponseResult(HttpStatusEnum.SUCCESS.getCode(), true, "查询成功", sMSTemplateManagementService.selectSMSTemplateManagementById(id));
    }

    /**
     * 查询 分页查询
     *
     * @author pengdongdong
     * @date 2024/11/11
     **/
    @GetMapping("/list")
    public SysResult selectSMSTemplateManagementList(Integer pageNum, Integer pageSize,
                                                     SMSTemplateManagement sMSTemplateManagement) {
        return SysResult.success(sMSTemplateManagementService
                .selectSMSTemplateManagementList(pageNum, pageSize, sMSTemplateManagement));
    }

}